package com.itheima.domain;

/**
 * 商品类
 */
public class Product {
    private Integer id;//商品编号，自动维护
    private String name;//商品姓名
    private Integer price;//商品价格
    private String address;//商品产地

    //自动维护id的变量
    private static Integer genericId = 1;

    public Product() {
        id = genericId++;
    }

    public Product(String name, Integer price, String address) {
        id = genericId++;
        this.name = name;
        this.price = price;
        this.address = address;
    }

    @Override
    public String toString() {
        return "Product{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", price=" + price +
                ", address='" + address + '\'' +
                '}';
    }

    public Integer getId() {
        return id;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
